import Vue from "vue";
import App from "./App.vue";
import router from "./router";
Vue.config.productionTip = false;
// 导入全局css文件
import './assets/css/css.css';
// 完整引入 Element
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
// 导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor';
// 富文本编辑器css样式
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css';
import 'quill/dist/quill.bubble.css';
Vue.use(VueQuillEditor);
// 导入树形table组件
import ZkTable from 'vue-table-with-tree-grid'
Vue.component('table-tree', ZkTable);
// 导入axios
import axios from 'axios';
Vue.prototype.$http = axios;
axios.defaults.baseURL = 'http://47.96.230.147:9999/api/private/v1/';
// 请求拦截器
axios.interceptors.request.use((config) => {
    // 给服务器发送令牌
    config.headers.Authorization = window.sessionStorage.getItem('token');
    return config;
  },
  // 捕获错误
  (error) => {
    return Promise.reject(error)
  });
// 过滤器
Vue.filter('filterTime', (time) => {
  let date = new Date(time);
  let year = date.getFullYear();
  let Month = (date.getMonth() + 1).toString().padStart(2, '0');
  let day = date.getDate().toString().padStart(2, '0');
  let hh = date.getHours().toString().padStart(2, '0');
  let mm = date.getMinutes().toString().padStart(2, '0');
  let ss = date.getSeconds().toString().padStart(2, '0');
  return `${year}-${Month}-${day} ${hh}:${mm}:${ss}`;
});
new Vue({
  router,
  render: h => h(App)
}).$mount("#app");